import { createDeepSeek } from '@ai-sdk/deepseek';
import { useMount } from 'ahooks';
import { generateText } from 'ai';
import { memo } from 'react';
import { outer_style } from './style';

const DeepSeek = () => {
  const init = async () => {
    const deepseek = createDeepSeek({
      baseURL: 'https://api.deepseek.com',
      apiKey: 'sk-cc123b736f334de8ace1f45097a89f92',
    });
    const { text } = await generateText({
      model: deepseek('deepseek-chat'),
      prompt: 'Write a JavaScript function that sorts a list:',
    });

    console.log(111, text);
  }

  useMount(() => {
    init();
  });

  return (
    <div className={outer_style}>
      DeepSeek
    </div>
  )
};

export default memo(DeepSeek);